<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
	<style type="text/css">
        /*	:first-child 选中的是第一个p标签	*/
        div p:first-child{
        	color: red;

        }
        /*    last-child 最后一个p标签 */
        div p:last-child{
        	color: green;
        }
        /* nth-child(n) (n>=1) n表示的是选取第n个标签       */
        div p:nth-child(2){
            color: hotpink;
        }
         /*  2n 选中偶数的p标签 */
        div p:nth-child(even){
        	text-decoration: underline;
        }
         /*  2n+1 选中奇数的p标签 */
        div p:nth-child(2n+1){
        	background:red;
        }
	</style>
</head>
<body>
     <div>
     	<p>今天好好吃一顿</p>
     	<p>今天好好吃两顿</p>
     	<p>今天好好吃三顿</p>
     	<p>今天好好吃四顿</p>
     	<p>今天好好吃五顿</p>
     	<p>今天好好吃六顿</p>
     	<p>今天好好吃七顿</p>
     	<p>今天好好吃八顿</p>
     	<p>今天好好吃九顿</p>
     </div>
</body>
</html>